#include "file_system.h"
#include<stdio.h>
#include<stdlib.h>
file_system::file_system()
{
}


file_system::~file_system()
{
}

char * file_system::load( char *name ){
	char *pResult = NULL;
	FILE *pFile = NULL;
	long iLen = 0;

	pFile = fopen(name, "r");

	if(pFile == NULL) {
		fprintf(stderr, "Error: Cannot read file '%s'\n", name);
		return NULL;
	}

	fseek(pFile, 0, SEEK_END); /* Seek end of file */
	iLen = ftell(pFile);
	fseek(pFile, 0, SEEK_SET); /* Seek start of file again */
	pResult = (char*)calloc(iLen+1, sizeof(char));
	fread(pResult, sizeof(char), iLen, pFile);
	pResult[iLen] = '\0';
	fclose(pFile);

	return pResult;
}
